package com.sg.service.impl;

import com.github.pagehelper.PageHelper;
import com.sg.bean.Remark;
import com.sg.dao.RemarkDao;
import com.sg.service.RemarkService;
import com.sg.vo.RemarkVO;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author fyp
 * 帖子评论业务逻辑实现类
 */
@Service
public class RemarkServiceImpl implements RemarkService {
    Logger logger=Logger.getLogger(RemarkServiceImpl.class);
    @Autowired
    RemarkDao remarkDao;
    @Override
    public List<RemarkVO> findAll() {
        return remarkDao.findAll();
    }

    @Override
    public Remark findById(int remarkId) {
        return remarkDao.findById(remarkId);
    }

    @Override
    public boolean add(Remark remark) {
        return remarkDao.add(remark)>0?true:false;
    }

    @Override
    public boolean update(Remark remark) {
        return remarkDao.update(remark)>0?true:false;
    }

    @Override
    public boolean delete(int[] arrays) {
        return remarkDao.delete(arrays)>0?true:false;
    }

    @Override
    public List<RemarkVO> findPersonList(int uId) {
        return remarkDao.findPersonList(uId);
    }

    @Override
    public List<RemarkVO> findList(int invitationId) {
        return remarkDao.findList(invitationId);
    }

    @Override
    public List<RemarkVO> findAllPage(int pageNum, int pageSize) {
        //开启分页
        PageHelper.startPage(pageNum,pageSize);
        return remarkDao.findAll();
    }
}
